
#include <iostream>
#include <math.h>

#if LINUX

#include <unistd.h>

#endif

#include <RenderSystem/include/RenderWindow.h>

using namespace std;





int main(void)
{
	RenderWindow window(1280, 800, "Render Window");
	
	while (!window.windowShouldClose())
	{
		float ratio;
		int width, height;
		window.getFrameBufferSize(width, height);
		ratio = width / (float) height;
		glViewport(0, 0, width, height);

		static float color = 0.0f;
		color += 0.01f;
		glClear(GL_COLOR_BUFFER_BIT);
		glClearColor(fabs(cos(color)),0, fabs(sin(color)),0);
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
		glBegin(GL_TRIANGLES);
		glColor3f(1.f, 0.f, 0.f);
		glVertex3f(-0.6f, -0.4f, 0.f);
		glColor3f(0.f, 1.f, 0.f);
		glVertex3f(0.6f, -0.4f, 0.f);
		glColor3f(0.f, 0.f, 1.f);
		glVertex3f(0.f, 0.6f, 0.f);
		glEnd();
		window.swapBuffers();
		glfwPollEvents();

#if _WIN32
		_sleep(30);
#elif LINUX 
		usleep(30000);
#endif

	}

}
